package it.koutifaris.travianmap.dal.sqlservices.tile;

import it.koutifaris.travianmap.dal.sqlservices.MapSqlContract.Villages;
import it.koutifaris.travianmap.tile.bounds.DefaultTileBounds;

class VillagesInBoundsQuery {

	static String getVillagesInBoundQuery() {
		String result = VillageQuery.getVillagesBaseQuery() + " AND "
				+ Villages.COLUMN_NAME_X + " BETWEEN ? AND ? AND "
				+ Villages.COLUMN_NAME_Y + " BETWEEN ? AND ? ";

		return result;
	}

	static String[] getSelectionArgs(long revisionId, DefaultTileBounds tileBounds) {
		return new String[] {
				String.valueOf(revisionId),
				String.valueOf(revisionId),
				String.valueOf(revisionId),
				String.valueOf(tileBounds.x()),
				String.valueOf(tileBounds.x() + tileBounds.width()),
				String.valueOf(tileBounds.y()),
				String.valueOf(tileBounds.y() + tileBounds.height())
		};

	}

}
